home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / powerb5.zip / P5DBS000.TIP < prev    next >
Text File  |  1993-06-01  |  2KB  |  64 lines

  1. When you delete records from a Paradox table, you don't
  2. regain even one byte of disk space! Paradox never physically
  3. deletes these records; it simply marks "deleted" records as
  4. unused. If you add more records, Paradox will reuse the
  5. space, but if you add fewer records than you've deleted,
  6. you're left with a bigger file than you need. Fortunately,
  7. there's an undocumented way to recover this wasted space.
  8. When you restructure a table (say, to change, add, or delete
  9. fields), Paradox rewrites and compacts it.
  10.  
  11. Because the restructuring feature doesn't check to see if
  12. you've actually changed anything, it provides a quick and
  13. easy way to compress a table. I wrote a PAL script named
  14. COMPRESS.SC that squeezes the table currently being viewed
  15. by removing the excess space left by deleted records. To run
  16. it, bring up the file in question, then select Scripts·Play,
  17. type COMPRESS, and press <Enter>. Your hard disk will run
  18. for a while, then COMPRESS will beep and tell you how much
  19. of the unused space you've regained. Note, however, that if
  20. you want to delete all the records in a table, you should
  21. use the EMPTY function instead of deleting all the records
  22. and compressing. EMPTY simply re-creates the disk file with
  23. no entries, freeing all the space that held the records.
  24.  
  25. David Babcock
  26. San Jose, California
  27.  
  28. Editor's Note: A listing of Mr. Babcock's PAL script appears
  29. below. It shrinks a Paradox data base by removing "deleted"
  30. records, which still take up space.
  31.  
  32. ---- BEGIN LISTING ----
  33. ;  COMPRESS.SC PAL script to compress current table
  34. ;                 By Dave Babcock
  35. ;
  36. ;  Make sure there is a current table
  37. IF NIMAGES() = 0 THEN
  38.   MESSAGE "No table to compress!"
  39.   BEEP SLEEP 5000
  40.   QUIT
  41. ENDIF
  42. ;  Complete any pending operation and return to main mode
  43. IF SYSMODE() <> "Main" THEN
  44.   DO_IT!
  45. ENDIF
  46. ;  Save size of current table
  47. OldSize = FILESIZE(TABLE()+".DB")
  48. ;  "Restructure" table with no changes to recover space
  49. MENU {Modify} {Restructure} SELECT TABLE() TYPEIN TABLE()
  50. {DO-IT!}
  51. ;  Report space saved by compaction
  52. NewSize = FILESIZE(TABLE()+".DB")
  53. MESSAGE STRVAL(OldSize - NewSize) + " bytes saved!"
  54. BEEP SLEEP 5000
  55. ---- END LISTING ----
  56.  
  57.  
  58. Title: Reducing a Paradox
  59. Category: DBS
  60. Issue Date: March, 1992
  61. Editor: Brett Glass
  62. Supplementary Files: None
  63. Filename: P5DBS000.TIP
  64.